/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.sorbonne.soa.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Nairo
 */
@Entity
@Table(name = "CUSTOMERORDER")
@NamedQueries({@NamedQuery(name = "Customerorder.findAll", query = "SELECT c FROM Customerorder c"), @NamedQuery(name = "Customerorder.findByOrderid", query = "SELECT c FROM Customerorder c WHERE c.orderid = :orderid"), @NamedQuery(name = "Customerorder.findByEstimateddelivery", query = "SELECT c FROM Customerorder c WHERE c.estimateddelivery = :estimateddelivery"), @NamedQuery(name = "Customerorder.findByEstimatedproductionstartdate", query = "SELECT c FROM Customerorder c WHERE c.estimatedproductionstartdate = :estimatedproductionstartdate"), @NamedQuery(name = "Customerorder.findByStatus", query = "SELECT c FROM Customerorder c WHERE c.status = :status"), @NamedQuery(name = "Customerorder.findByAmount", query = "SELECT c FROM Customerorder c WHERE c.amount = :amount"), @NamedQuery(name = "Customerorder.findByIspaid", query = "SELECT c FROM Customerorder c WHERE c.ispaid = :ispaid")})
public class Customerorder implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ORDERID")
    private String orderid;
    @Column(name = "ESTIMATEDDELIVERY")
    @Temporal(TemporalType.DATE)
    private Date estimateddelivery;
    @Column(name = "ESTIMATEDPRODUCTIONSTARTDATE")
    @Temporal(TemporalType.DATE)
    private Date estimatedproductionstartdate;
    @Basic(optional = false)
    @Column(name = "STATUS")
    private String status;
    @Column(name = "AMOUNT")
    private Double amount;
    @Basic(optional = false)
    @Column(name = "ISPAID")
    private int ispaid;
    @JoinColumn(name = "MANUFACTURER", referencedColumnName = "MANUFACTURERID")
    @ManyToOne
    private Manufacturerinfo manufacturer;
    @JoinColumn(name = "SHIPPER", referencedColumnName = "SHIPPINGCOMPANYID")
    @ManyToOne
    private Shipperinfo shipper;

    public Customerorder() {
    }

    public Customerorder(String orderid) {
        this.orderid = orderid;
    }

    public Customerorder(String orderid, String status, int ispaid) {
        this.orderid = orderid;
        this.status = status;
        this.ispaid = ispaid;
    }

    public String getOrderid() {
        return orderid;
    }

    public void setOrderid(String orderid) {
        this.orderid = orderid;
    }

    public Date getEstimateddelivery() {
        return estimateddelivery;
    }

    public void setEstimateddelivery(Date estimateddelivery) {
        this.estimateddelivery = estimateddelivery;
    }

    public Date getEstimatedproductionstartdate() {
        return estimatedproductionstartdate;
    }

    public void setEstimatedproductionstartdate(Date estimatedproductionstartdate) {
        this.estimatedproductionstartdate = estimatedproductionstartdate;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Double getAmount() {
        return amount;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }

    public int getIspaid() {
        return ispaid;
    }

    public void setIspaid(int ispaid) {
        this.ispaid = ispaid;
    }

    public Manufacturerinfo getManufacturer() {
        return manufacturer;
    }

    public void setManufacturer(Manufacturerinfo manufacturer) {
        this.manufacturer = manufacturer;
    }

    public Shipperinfo getShipper() {
        return shipper;
    }

    public void setShipper(Shipperinfo shipper) {
        this.shipper = shipper;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (orderid != null ? orderid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Customerorder)) {
            return false;
        }
        Customerorder other = (Customerorder) object;
        if ((this.orderid == null && other.orderid != null) || (this.orderid != null && !this.orderid.equals(other.orderid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fr.sorbonne.soa.entity.Customerorder[orderid=" + orderid + "]";
    }

}
